class Solution:
    # @param n, an integer
    # @return an integer
    def reverseBits(self, n):
        ret, power = 0, 31
        while n:
            ret += (n & 1) << power
            n = n >> 1
            power -= 1
        return ret

if __name__ == '__main__':
    so = Solution()
    s = 43261596
    r = so.reverseBits(s)
    print(r)
